/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-05-14
 * Time: 20:40
 */
class Student{
    //成员变量
    public String name ;
    int numb;
    private float score;
    static String classroom;
//带参数的构造方法
    public Student(String name, int numb, float score) {
        this.name = name;
        this.numb = numb;
        this.score = score;
    }
    //静态代码块
    static {
        classroom = "120";
        System.out.println("静态代码块被执行了");
    }
    //实例代码块
    {
        this.name = "sb";
        System.out.println("实例代码块被执行了");
    }
//普通成员方法
    public void fun1(){
        System.out.println(name+classroom+"普通成员方法被执行了");
    }
    //静态成员方法
    static void fun2(){
        System.out.println("静态成员方法被执行了");

    }
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", numb=" + numb +
                ", score=" + score +
                ", classroom=" + classroom+
                '}';
    }
}
public class StaticTest {
    public static void main(String[] args) {
        Student stu1 = new Student("denghui",1121245,115.0f);
        System.out.println(stu1);
        stu1.fun1();
        Student stu2 = new Student("lihua",15466,65.0f);
        System.out.println(stu2);
        stu2.fun1();
    }

}
